home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.19981211-19990422
/
000129_news@watsun.cc.columbia.edu _Sat Jan 16 15:15:37 1999.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
4KB
Return-Path: <news@watsun.cc.columbia.edu>
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id PAA03869
for <kermit.misc@watsun.cc.columbia.edu>; Sat, 16 Jan 1999 15:15:37 -0500 (EST)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id PAA04538
for kermit.misc@watsun.cc.columbia.edu; Sat, 16 Jan 1999 15:08:29 -0500 (EST)
X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Subject: Re: Telnet macro. Does it exist?
Date: 16 Jan 1999 20:08:28 GMT
Organization: Columbia University
Message-ID: <77qrjs$4dn$1@newsmaster.cc.columbia.edu>
To: kermit.misc@mailrelay2.cc.columbia.edu
In article <77p8q2$r4n$1@jupiter.mcs.net>, Leslie Mikesell <les@MCS.COM> wrote:
: In article <369F9217.576CB86C@newbridge.com>,
: Christian Brideau <cbrideau@newbridge.com> wrote:
: >I want to automate complete telnet sessions. In other words, logon-do
: >stuff-get out.
: >
: >Is this scriptable? If not is there a macro software out there that I
: >could use to perform this task?
:
: Kermit from http://www.columbia.edu/kermit/ has a reasonable scripting
: language that works the same with serial ports or telnet sessions.
:
Right. This is a better solution than expect combined with regular telnet,
since it is self-contained, eliminating timing and coordination problems that
might occur between the two local applications, on top of whatever might
happen at the remote end.
A typical Kermit script for making a Telnet connection might look like this;
this assumes you already have the following variables set:
\%h = hostname
\%u = username on host
\%p = password for user on host
\%s = shell prompt on host (e.g. \13\10$\32)
Backslash followed by digit indicates an ASCII character value, so the
prompt example means "carriage return, linefeed, dollar sign, space" or
(in plain words) a dollar sign on the left margin.
These can be set in any of various ways -- hardwired into the script
(bad idea), prompted for interactively, taken from environment variables,
read from a database, etc. Here's the script:
set host \%h ; Make the connection
if failure stop 1 Connection failure ; Check for failure
input 30 login: ; Wait 30 sec for login: prompt.
if failure stop 1 No login prompt ; Give up on timeout
output \%u\13 ; Send user ID and carriage return.
input 10 Password: ; Wait 10 sec for Password: prompt.
output \%p\13 ; Send password and carriage return.
input 60 \%s ; Wait 60 sec for shell prompt.
Now you're logged in and ready to give system commands, for example:
output kermit -x\13 ; Start remote Kermit in server mode.
send neworders.txt ; Tell local Kermit to send a file.
if success delete neworders.txt ; Delete source file if OK.
get inventory.txt ; Download a file from the server
etc etc. When done:
bye ; Shut down and log out the server.
exit
The "exit" command automatically closes the connection.
This simple example should be enough to get you started. There's lots more;
loops, functions, arrays, etc. More info at:
http://www.columbia.edu/kermit/ckermit.html
- Frank